import api from '../../utils/api'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    dataList: [],
    uid: '',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    const { getFullDataParams, uid } = options
    if (getFullDataParams) {
      this.getVaccineProductV3List(JSON.parse(getFullDataParams))
      this.setData({
        uid
      })
    } else {
      this.goBack()
    }

  },
  getVaccineProductV3List(params) {
    api.vaccineProductV3List({
      data: {
        ...params,
        pageSize: 100
      },
      success: (res) => {
        if (+res.code === 0) {
          this.setData({
            dataList: res.data.dataList
          })
        } else {
          this.goBack()
        }
      },
      fail: () => {
        this.goBack()
      }
    })
  },
  goBack() {
    wx.navigateBack({
      delta: 1
    });
  }
})